package dbTools.coeModel;

import java.util.Map;

import dbTools.DBToolEngine;
import dbTools.factory.CodeModelFactory;
import dbTools.tableInfo.info.TableInfo;

public class CodeModelCreator {

	public static void createCodes(String modelName,Map<String,TableInfo> tableInfos) {
		
		CodeModel model=CodeModelFactory.getCodeModel(modelName);
		
		model.setMainPath(DBToolEngine.getWorkSpacePath());
		
		for (Map.Entry<String, TableInfo> entry : tableInfos.entrySet()) 
		{
			model.writeCodes(entry.getValue());
		}
		
		if(model.getMainMethod()!=null)
		{
			model.getMainMethod().doMainMethod(model,tableInfos);
		}
	}
}
